
   <html>
   <head>
   <style type=text/css>
   body { font-size: 10pt; font-family: Arial; }
   </style>
   </head>
   <body>
   
</br>
</br>
<font color="darkred">#include</font>&lt;stdio.h&gt;</br>
<font color="darkred">#include</font>&lt;coelacanth/vector.h&gt;</br>
</br>
<font color="darkgreen">int</font>&nbsp;cmp(<font color="darkgreen">const</font>&nbsp;void&nbsp;*a,&nbsp;<font color="darkgreen">const</font>&nbsp;void&nbsp;*b)</br>
{</br>
&nbsp;&nbsp;&nbsp;<font color="darkgreen">int</font>&nbsp;*ia,&nbsp;*ib;</br>
</br>
&nbsp;&nbsp;&nbsp;ia&nbsp;=&nbsp;(<font color="darkgreen">int</font>&nbsp;*)&nbsp;a;</br>
&nbsp;&nbsp;&nbsp;ib&nbsp;=&nbsp;(<font color="darkgreen">int</font>&nbsp;*)&nbsp;b;</br>
</br>
&nbsp;&nbsp;&nbsp;<font color="#6d4d00">return</font>&nbsp;(*ia&nbsp;-&nbsp;*ib);</br>
}</br>
</br>
void&nbsp;add_elements(void&nbsp;*v,&nbsp;<font color="darkgreen">int</font>&nbsp;*v_size)</br>
{</br>
&nbsp;&nbsp;&nbsp;vector_ptr(vec,&nbsp;<font color="darkgreen">int</font>);</br>
&nbsp;&nbsp;&nbsp;vec&nbsp;=&nbsp;v;</br>
</br>
&nbsp;&nbsp;&nbsp;vector_add(vec,&nbsp;*v_size,&nbsp;<font color="darkgreen">int</font>,&nbsp;3);</br>
&nbsp;&nbsp;&nbsp;vector_add(vec,&nbsp;*v_size,&nbsp;<font color="darkgreen">int</font>,&nbsp;5);</br>
&nbsp;&nbsp;&nbsp;vector_add(vec,&nbsp;*v_size,&nbsp;<font color="darkgreen">int</font>,&nbsp;11);</br>
&nbsp;&nbsp;&nbsp;vector_add(vec,&nbsp;*v_size,&nbsp;<font color="darkgreen">int</font>,&nbsp;7);</br>
}</br>
</br>
<font color="darkgreen">int</font>&nbsp;main()</br>
{</br>
&nbsp;&nbsp;&nbsp;vector(v,&nbsp;v_size,&nbsp;<font color="darkgreen">int</font>);</br>
&nbsp;&nbsp;&nbsp;vector_add(v,&nbsp;v_size,&nbsp;<font color="darkgreen">int</font>,&nbsp;2);</br>
</br>
&nbsp;&nbsp;&nbsp;add_elements(v,&nbsp;&v_size);</br>
</br>
&nbsp;&nbsp;&nbsp;qsort(v,&nbsp;v_size,&nbsp;sizeof(<font color="darkgreen">int</font>),&nbsp;cmp);</br>
</br>
&nbsp;&nbsp;&nbsp;<font color="darkgreen">int</font>&nbsp;i;</br>
&nbsp;&nbsp;&nbsp;for(i=0;&nbsp;i&lt;v_size;&nbsp;i++)</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("%d&nbsp;",&nbsp;v[i]);</br>
&nbsp;&nbsp;&nbsp;pr<font color="darkgreen">int</font>f("\n");</br>
</br>
&nbsp;&nbsp;&nbsp;vector_free(v);</br>
</br>
&nbsp;&nbsp;&nbsp;<font color="#6d4d00">return</font>&nbsp;0;</br>
}</br>
</br>
</body></html>
